home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 23
/
Amiga Format AFCD23 (Feb 1998, Issue 107).iso
/
-in_the_mag-
/
emulation
/
cpu
/
z80
/
impldept.i
< prev
next >
Wrap
Text File
|
1997-12-12
|
3KB
|
133 lines
** The implementation-dependent Z80 instructions.
** (More or less just the label-defining mechanisms.)
** If the label GENERIC_OBJECT is defined, these instructions will be
** assumed defined in a separate object file. When for instance "In A,(n)"
** is executed, a jump will be made to the XREF:ed label "Z80_In_A_1n1".
** They will be about 12 clocks slower, but it provides more flexibility
** (and some more address space for the cache vectors).
** The file 'extern_instr.a' compiles to such an object file.
** If GENERIC_OBJECT is not defined, they will be inline expanded like
** normal instruction routines, the macros taken from a file named
** 'machine_macs.i'. (I expect the macros in 'generic_macs.i' will never
** be used for this purpose - if you compile for maximum speed, why use
** the non-optimised routines?) This will create a machine-specific object
** file, not needing any XREF:ed instructions, but clearly only useful for
** a single project. Note: There is nothing stopping you from making some
** (or even all, but why?) of the macros in 'machine_macs.i' jump to
** external labels, if you wish to create a "slightly more specialised"
** Z80 emulator object file.
** The macro names are made from the instruction labels with "_mac"
** appended, and the external labels are "Z80_" with the instruction
** labels appended.
** There must be a separate macro for each instruction label.
** Tests for self-modifying code should not be included in the macros!
** They are executed before the macro expansion/jump to label.
** ======================================================================
IFD VERBOSE
LIST
** Compiling the impldept.i file.
NOLIST
ENDC
IFD GENERIC_OBJECT
IFD VERBOSE
LIST
** Creating a generic object file. Jumps to external labels are created
** for the implementation-dependent instruction routines.
NOLIST
ENDC
;Macro to cross-ref and jump
IMPLDEPT MACRO ;Instruction_name, [ do_before_call ]
XREF Z80_\1
\1 \2
jmp Z80_\1
ENDM
ELSE
IFD VERBOSE
LIST
** Using machine-specific macros from the file machine.i, and expanding
** the macros inline.
NOLIST
ENDC
;Get the instruction macros
INCLUDE machine_macs.i
;Macro to inline expand instruction macro
IMPLDEPT MACRO ;Instruction_name, [ do_before_call ]
\1 \2
\1_mac
ENDM
ENDC ;IFD GENERIC_OBJECT
**
** The instruction labels begin here:
**
In_r_1C1 MACRO
IMPLDEPT In_\1_1C1,opcode_2_bytes
ENDM
do_r In_r_1C1
IMPLDEPT In_H_1C1,opcode_2_bytes
IMPLDEPT In_xx_1C1,opcode_2_bytes ;undocumented
IMPLDEPT In_A_1n1
IMPLDEPT Ind,opcode_2_bytes
IMPLDEPT Indr,opcode_2_bytes
IMPLDEPT Ini,opcode_2_bytes
IMPLDEPT Inir,opcode_2_bytes
IMPLDEPT Ld_A_R,opcode_2_bytes
IMPLDEPT Ld_R_A,opcode_2_bytes
IMPLDEPT Otdr,opcode_2_bytes
IMPLDEPT Otir,opcode_2_bytes
Out_1C1_r MACRO
IMPLDEPT Out_1C1_\1,opcode_2_bytes
ENDM
do_r Out_1C1_r
IMPLDEPT Out_1C1_H,opcode_2_bytes
IMPLDEPT Out_1C1_xx,opcode_2_bytes ;undocumented
IMPLDEPT Out_1n1_A
IMPLDEPT Outd,opcode_2_bytes
IMPLDEPT Outi,opcode_2_bytes
IMPLDEPT Reti,opcode_2_bytes
IMPLDEPT Retn,opcode_2_bytes
** =====================================================================